var mysql = require('mysql');

var conn = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '1',
    port: '3306',
    database: 'test'
})

conn.connect();

//var query1 = "select UUID() from dual"
//var query1 = "select * from user limit 10"
//var query1 = "desc user"


var deletequ = "delete from t_user where id=1"


var addsql = "INSERT INTO `t_user` (`name`, `age`) VALUES (?, ?)";

var addcolumn = ['黄药师', 33];

var queryUser = "select * from user";
//调用执行查询方法


//执行删除 查询 callback回调函数
exports.query = function (query, callback) {
    conn.query(query, function (err, result) {
        if (err) {
            console.log(err)
        }
        callback(result)
    })
}

//新增 更新
conn.query(addsql, addcolumn, function (err, result) {
    if (err) {
        console.log(err)
    }
    console.log(result)
    return 1;
})